<template>
  <view class="custom-navigation-bar">
    <view class="left-button"> </view>
    <view class="title">
      {{ title }}
    </view>
    <view class="right-button" @click="handleBack">
      <span>清空</span>
    </view>
  </view>
</template>

<script>
import { $https } from "@/static/js/request.js";
export default {
  props: {
    title: {
      type: String,
      default: "购物车",
    },
  },
  methods: {
    handleBack() {
      // 清空购物车
      // uni.navigateBack();
      uni.showModal({
        content: "是否清空购物车",
        confirmColor: "#4FA388",
        success: (res) => {
          if (res.confirm) {
            $https(
              "GET",
              // `delCart?company_id=${this.companyInfo.supplier_id}`,
              "delCart",
              {},
              (result) => {
                if (result.data.errcode == 0) {
                  // this.checkedList = [];
                  // this.getData();
                  this.$emit("plusdle");
                }
              }
            );
          } else if (res.cancel) {
            console.log("用户点击取消");
          }
        },
      });
    },
  },
};
</script>

<style lang="scss">
.custom-navigation-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 88rpx;
  background: #ffffff;
}

.left-button,
.right-button {
  padding: 0 30rpx;
  span {
    width: 54rpx;
    height: 26rpx;
    font-size: 28rpx;
    font-family: PingFang SC;
    font-weight: 400;
    color: #666666;
  }
}

.title {
  //   flex: 1;
  text-align: center;
  margin-left: 50rpx;
  font-size: 36rpx;
  font-family: PingFang SC;
  font-weight: bold;
  color: #01000d;
  //   font-weight: 500;
}
</style>
